<template>
	<view>
		<uni-list>
			<uni-list-item thumb="/static/images/icon/zhengjian.png" thumb-size="sm"  title="用户名"  :rightText="my.username" />
			<uni-list-item thumb="/static/images/icon/xingming.png" thumb-size="sm"  title="姓名"  :rightText="my.name"  link @click="updateName" />
			<uni-list-item thumb="/static/images/icon/bumen.png" thumb-size="sm"  title="部门"  :rightText="my.department" />
			<uni-list-item thumb="/static/images/icon/zhiwei.png" thumb-size="sm"  title="职位"  :rightText="my.position" />
			<uni-list-item thumb="/static/images/icon/shoujihao.png" thumb-size="sm"  title="手机号"  :rightText="my.number" link  @click="updateNumber"/>
			<uni-list-item thumb="/static/images/icon/xiugai.png" thumb-size="sm"  title="修改密码"  clickable link   @click="updatePassword"  />
		    <uni-list-item :disabled="true" class="slot-box"  title="" rightText="" />
			<uni-list-item thumb="/static/images/icon/qingli.png" thumb-size="sm"  title="清理缓存"  clickable link   @click="clear"  />
		</uni-list>
		
		<uni-list :border="false">
			<uni-list-item :disabled="true"   title="" rightText="" />
		</uni-list>
		
		
		<view class="uni-padding-wrap uni-common-mt">
		      <button type="warn" class="button-sp-area" @click="logout" >退出登录</button>     
		</view>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				my: {
					name: '',
					username: '',
					department: '',
					position: '',
					number: '',
				}
			}
		},
		onLoad() {
			
			let user = uni.getStorageSync('userMess');
			this.my.name = user.name
			this.my.username = user.username
			this.my.department = user.department_name
			this.my.position = user.job
			this.my.number = user.tel
		},
		onPullDownRefresh() { //下拉刷新
		        setTimeout (() => {
					
		            uni.stopPullDownRefresh();
		        }, 1000);
		},
		methods: {
			updateName(){
			   this.$to.jumpTo('/my/myupdate?type=1')
			},
			updateNumber(){
				this.$to.jumpTo('/my/myupdate?type=2')
			},
			updatePassword(){
				this.$to.jumpTo('/my/myupdate?type=0')
			},
			clear(){ //清理
				
			},
			logout(){ //注销
				uni.removeStorageSync('token');
				uni.redirectTo({
				    url: '/pages/login/login'
				});
				
			}
		}
	}
</script>

<style>
	.slot-box{
		background-color: #C0C0C0;
	}
	.button-sp-area{
		margin: 0 auto;
		width: 60%;

	}

</style>
